home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 117 / PC Guia 117.iso / Software / Produtividade / Software2 / Product4 / Setup.exe / drupal-4.6.0 / modules / page.module < prev    next >
Encoding:
Text File  |  2005-02-08  |  1.6 KB  |  81 lines

  1. <?php
  2. // $Id: page.module,v 1.132 2005/02/08 19:44:39 dries Exp $
  3.  
  4. /**
  5.  * @file
  6.  * Enables the creation of pages that can be added to the navigation system.
  7.  */
  8.  
  9. /**
  10.  * Implementation of hook_help().
  11.  */
  12. function page_help($section) {
  13.   switch ($section) {
  14.     case 'admin/modules#description':
  15.       return t('Enables the creation of pages that can be added to the navigation system.');
  16.     case 'node/add#page':
  17.       return t('If you want to add a static page, like a contact page or an about page, use a page.');
  18.   }
  19. }
  20.  
  21. /**
  22.  * Implementation of hook_perm().
  23.  */
  24. function page_perm() {
  25.   return array('create pages', 'edit own pages');
  26. }
  27.  
  28. /**
  29.  * Implementation of hook_node_name().
  30.  */
  31. function page_node_name($node) {
  32.   return t('page');
  33. }
  34.  
  35. /**
  36.  * Implementation of hook_access().
  37.  */
  38. function page_access($op, $node) {
  39.   global $user;
  40.  
  41.   if ($op == 'create') {
  42.     return user_access('create pages');
  43.   }
  44.  
  45.   if ($op == 'update' || $op == 'delete') {
  46.     if (user_access('edit own pages') && ($user->uid == $node->uid)) {
  47.       return TRUE;
  48.     }
  49.   }
  50. }
  51.  
  52. /**
  53.  * Implementation of hook_menu().
  54.  */
  55. function page_menu($may_cache) {
  56.   $items = array();
  57.  
  58.   if ($may_cache) {
  59.     $items[] = array('path' => 'node/add/page', 'title' => t('page'),
  60.       'access' => page_access('create', NULL));
  61.   }
  62.  
  63.   return $items;
  64. }
  65.  
  66. /**
  67.  * Implementation of hook_form().
  68.  */
  69. function page_form(&$node) {
  70.   if (function_exists('taxonomy_node_form')) {
  71.     $output .= implode('', taxonomy_node_form('page', $node));
  72.   }
  73.  
  74.   $output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
  75.   $output .= filter_form('format', $node->format);
  76.  
  77.   return $output;
  78. }
  79.  
  80. ?>
  81.